<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>document</title>
		<script>
			function showDoc(){
				alert("ref:"+window.document.referrer);
				alert("url:"+window.document.URL);
				alert("domain:"+window.document.domain);
				alert("lastModified:"+window.document.lastModified);
			}
			function changeH1(){
				let h=document.getElementById("D1");
				alert(h.innerHTML);
				
				//h.innerHTML="何涛刚才做<a href='https://www.fupo.com' target='_blank'>春梦</a>了";
				h.innerText="何涛刚才做<a href='https://www.fupo.com' target='_blank'>春梦</a>了";
			}
			function getLike(){
				var ar=document.getElementsByName("like");
				var str="";
				/* for(var i in ar){
					console.log("i="+i);
					str+=ar[i].value+" ";
				} */
				for(var i=0;i<ar.length;i++){
					console.log("i="+i);
					str+=ar[i].value+" ";
				}
				alert(str);
			}
			function getH1(){
				var h=document.getElementsByTagName("h1");
				for(let i=0;i<h.length;i++){
					h[i].align="right";
				}
			}
		</script>
	</head>
	<body>
		<h1>
			<a href="#">taobao</a>
		</h1>
		<h1 id="D1">
			We change lives
		</h1>
		<div>
			<input type="text" name="like" value="跳舞"/>
			<input type="text" name="like" value="游戏"/>
			<input type="text" name="like" value="睡觉"/>
			<input type="text" name="like" value="吃饭"/>
		</div>
		<input type="button" value="改变h1" onclick="changeH1()"/>
		<input type="button" value="获得你的爱好" onclick="getLike()"/>
		<input type="button" value="获得所有的h1" onclick="getH1()"/>
	</body>
</html>
